/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

/**
 * 常用工具-订单管理
 *  */
import { Request, Response } from 'express';
import { responseSuccess } from '../utils';
import Mock from 'mockjs';

export default {
  'POST /order/getList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'result|1-30': [
        {
          id: '@id()',
          waybill_no: '@id()',
          'status|1': ['0', '1', '2', '7', '8', '9', '-9', '-8', '-7', '-2', '-1', '-20'],
          shipper_name: '@cname()',
          shipper_mobile: '12345678910',
          collect_shop_name: '@cname(2,7)',
          create_at: '@now()',
          update_at: '@now()',
        },
      ],
    });
    const len = data.result.length;
    return res.json({
      code: 0,
      data: {
        ...data,
        total: len,
      },
      msg: 'success',
    });
  },
  'GET /order/info': (req: Request, res: Response) => {
    const data = Mock.mock({
      order: {
        id: '@id()',
        shipper_uid: '@id()',
        shipper_name: '@cname(2, 4)',
        create_at: '@now()',
        'status|1': ['0', '1'], //, '2', '7', '8', '9', '-9', '-8', '-7', '-2', '-1', '-20'],
        'brand|1': ['申通', '顺丰'],
        collect_shop_name: '@cname()',
        waybill_no: '@id()',
        collect_courier_name: '@cname()',
        collect_courier_mobile: '12345678901',
        'package_info|1': ['日用品', '生鲜'],
        'package_weight|1-10': 10,
        'charging_weight|1-10': 10,
        package_note: '@cname()',
        shipper_mobile: '12345678901',
        'shipper_province|1': ['上海市', '安徽省'],
        'shipper_city|1': ['上海市', '某某市'],
        'shipper_district|1': ['某某县', '某某县1'],
        shipper_address: '@cname()',
        shipper_tel: '12345678901',
        reason_fail: '@cname(10, 12)',
        source_name: '@cname(3, 5)',

        shipping_name: '@cname()',
        shipping_mobile: '12345678901',
        'shipping_province|1': ['上海市', '安徽省'],
        'shipping_city|1': ['上海市', '某某市'],
        'shipping_district|1': ['某某县', '某某县1'],
        shipping_address: '@cname()',
        shipping_tel: '12345678901',
        'channel|1': ['渠道1', '渠道2'],
        'freight|1-10': 10,
        'receipts_under_custody|1-10': 10,
        'claiming_value|1-10': 10,
        'claiming_value_pay|1-10': 10,
      },
      operation: [
        {
          'system|1': ['other', 'user', 'shop', 'courier', 'admin'],
          reason: '@csentence()',
          create_at: '@now()',
        },
        {
          'system|1': ['other', 'user', 'shop', 'courier', 'admin'],
          reason: '@csentence(30, 31)',
          create_at: '@now()',
        },
      ],
      info: {
        'handle_status|1': [0, 1, 2, 3, 4],
        'pay_status|1': [0, 1, 3],
        'handle_message|1': ['快递员', '客服'],
      },
      'orderReceipt|1': ['wechat', 'alipay', 'ss', 'aa'],
    });
    return res.json({
      code: 0,
      data,
      msg: 'success',
    });
  },
  'POST /order/reallyReject': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/cancel': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/refundMoneyAndStatus': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/refund': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/searchShop': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          index_shop_id: '@id()',
          index_shop_name: '@cname()',
        },
      ],
    });
    return res.json({
      code: 0,
      data: data.list,
      msg: 'success',
    });
  },
  'POST /order/resetShop': (req: Request, res: Response) => responseSuccess(req, res),
};
